package cn.bx.consumer.service;

import org.example.pojo.AjaxResult;
import org.example.pojo.Page;
import org.example.pojo.User;
import org.example.pojo.Userrole;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@FeignClient("bid")
public interface UserFeignClient {
    @GetMapping(value = "userGet", produces = "application/json;charset=utf-8")
    public AjaxResult userGet(@RequestParam("id") long id);

    @PostMapping(value = "login", produces = "application/json;charset=utf-8")
    public AjaxResult login(@RequestBody User user);

    @GetMapping(value = "userSearch", produces = "application/json;charset=utf-8")
    public Page<User> userSearch(@RequestParam(name = "page", defaultValue = "1") int pageNo, @RequestParam(name = "limit", defaultValue = "10") int limit, @RequestParam(name = "name", required = false) String name, @RequestParam(name = "start", required = false) String start, @RequestParam(name = "end", required = false) String end);

    @GetMapping(value = "findRoles", produces = "application/json;charset=utf-8")
    public List<Userrole> findRoles();

    @PostMapping(value = "userAdd", produces = "application/json;charset=utf-8")
    public AjaxResult userAdd(User user);

    @PostMapping(value = "userUpdate", produces = "application/json;charset=utf-8")
    public AjaxResult userUpdate(User user);

    @GetMapping(value = "userdel", produces = "application/json;charset=utf-8")
    public AjaxResult del(@RequestParam("id") long id);

    @GetMapping(value = "batchDeluser", produces = "application/json;charset=utf-8")
    public AjaxResult batchDel(@RequestParam("ids[]") long[] ids);

    @RequestMapping(value = "checkUserNameRepeat", produces = "application/json;charset=utf-8")
    public AjaxResult checkUserNameRepeat(@RequestParam("userName") String userName, @RequestParam(value = "id", required = false) Long id);
}
